home *** CD-ROM | disk | FTP | other *** search
- Path: ta4.cs.uiuc.edu!tandon
- From: tandon@cs.uiuc.edu (Ruchi Tandon)
- Newsgroups: comp.lang.c++
- Subject: Template classes - linking problem
- Date: 11 Apr 96 22:04:21 GMT
- Organization: University of Illinois at Urbana
- Message-ID: <tandon.829260261@ta4.cs.uiuc.edu>
- NNTP-Posting-Host: ta4.cs.uiuc.edu
- X-Newsreader: NN version 6.5.0 (NOV)
-
- I have a template class defined :
- template <class T> List { ..... }
-
- The class definition & all the member functions are in the file list.h
-
- I use this template to create lists of objects A & B.
- I include list.h in the files where I use List<A> or List<B> classes.
-
- Now when I compile my code, I get a linking error :
-
- ld : function <some member function of List<Vertex> class > redefined
- ( found both in main.o and graph.o )
- fatal error.
-
-
- I have included list.h in both main.c & graph.c
- Why does this happen & how can I get over this problem
-
- Thanks
-
- ruchi
- --
- ___________________________________________________________________________
- Name : Ruchi Tandon
- Office : 1105 DCL, 1304 W Springfield Ave, Urbana, IL 61801
- Postal Address : 2413 DCL, 1304 W Springfield Ave, Urbana, IL 61801
-